home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / xdvi-dos / src / maketexp < prev    next >
Text File  |  1992-10-21  |  3KB  |  142 lines

  1. #!/bin/sh
  2. #
  3. #   This script file makes a new TeX PK font, because one wasn't
  4. #   found.  Parameters are:
  5. #
  6. #   name dpi bdpi magnification [mode [subdir]]
  7. #
  8. #   `name' is the name of the font, such as `cmr10'.  `dpi' is
  9. #   the resolution the font is needed at.  `bdpi' is the base
  10. #   resolution, useful for figuring out the mode to make the font
  11. #   in.  `magnification' is a string to pass to MF as the
  12. #   magnification.  `mode', if supplied, is the mode to use.
  13. #
  14. #   Note that this file must execute Metafont, and then gftopk,
  15. #   and place the result in the correct location for the PostScript
  16. #   driver to find it subsequently.  If this doesn't work, it will
  17. #   be evident because MF will be invoked over and over again.
  18. #
  19. #   Of course, it needs to be set up for your site.
  20. #
  21. TEXDIR=/usr/lib/tex
  22. LOCALDIR=/LocalLibrary/Fonts/TeXFonts
  23. DESTDIR=$LOCALDIR/pk
  24. #
  25. # TEMPDIR needs to be unique for each process because of the possibility
  26. # of simultaneous processes running this script.
  27. #
  28. if test "$TMPDIR" = ""
  29. then
  30.    TEMPDIR=/tmp/mtpk.$$
  31. else
  32.    TEMPDIR=$TMPDIR/mtpk.$$
  33. fi
  34. NAME=$1
  35. DPI=$2
  36. BDPI=$3
  37. MAG=$4
  38. MODE=$5
  39.  
  40. umask 0
  41.  
  42. if test "$MODE" = ""
  43. then
  44.    if test $BDPI = 300
  45.    then
  46.       MODE=imagen
  47.    elif test $BDPI = 200
  48.    then
  49.       MODE=FAX
  50.    elif test $BDPI = 360
  51.    then
  52.       MODE=nextII
  53.    elif test $BDPI = 400
  54.    then
  55.       MODE=nexthi
  56.    elif test $BDPI = 100
  57.    then
  58.       MODE=nextscreen
  59.    elif test $BDPI = 635
  60.    then
  61.       MODE=linolo
  62.    elif test $BDPI = 1270
  63.    then
  64.       MODE=linohi
  65.    elif test $BDPI = 2540
  66.    then
  67.       MODE=linosuper
  68.    else
  69.       echo "I don't know the mode for $BDPI"
  70.       echo "Have your system admin update MakeTeXPK"
  71.       exit 1
  72.    fi
  73. fi
  74.  
  75. #  Something like the following is useful at some sites.
  76. # DESTDIR=/usr/local/lib/tex/fonts/pk.$MODE
  77. GFNAME=$NAME.$DPI'gf'
  78. PKNAME=$NAME.$DPI'pk'
  79.  
  80. # Clean up on normal or abnormal exit
  81. trap "cd /; /bin/rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
  82.  
  83.  
  84. if test ! -d $DESTDIR
  85. then
  86.    mkdir $DESTDIR
  87. fi
  88.  
  89. if test "$6" != ""
  90. then
  91.    DESTDIR=$DESTDIR"$6"
  92.    if test ! -d $DESTDIR
  93.    then
  94.       mkdir $DESTDIR
  95.    fi
  96. fi
  97.  
  98. mkdir $TEMPDIR
  99. cd $TEMPDIR
  100.  
  101. if test -r $DESTDIR/$PKNAME
  102. then
  103.    echo "$DESTDIR/$PKNAME already exists!"
  104.    exit 0
  105. fi
  106.  
  107. # check also in the standard place
  108.  
  109. if test "$6" = ""
  110. then
  111.    if test -r $TEXDIR/fonts/pk/$PKNAME
  112.    then
  113.       echo $TEXDIR/fonts/pk/$PKNAME already exists!
  114.       exit 0
  115.    fi
  116. else
  117.    if test -r $TEXDIR/fonts/pk/$6"$PKNAME"
  118.    then
  119.       echo $TEXDIR/fonts/pk/$6"$PKNAME" already exists!
  120.       exit 0
  121.    fi
  122. fi
  123.  
  124. echo "mf \"\\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME\" < /dev/null"
  125. mf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" < /dev/null
  126. if test ! -r $GFNAME
  127. then
  128.    echo "Metafont failed for some reason on $GFNAME"
  129.    exit 1
  130. fi
  131.  
  132. gftopk -v ./$GFNAME ./$PKNAME
  133.  
  134. # Install the PK file carefully, since others may be doing the same
  135. # as us simultaneously.
  136.  
  137. mv $PKNAME $DESTDIR/pktmp.$$
  138. cd $DESTDIR
  139. mv pktmp.$$ $PKNAME
  140.  
  141. exit 0
  142.